<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script>
    $(function () {
        $("#examApplyTable").treeTable();
        $("#symptom").val(unescape($("#symptom").val()));

    })

    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#examApplyForm").submit();
        return false;
    }

    function printPresc(examId,visitId,patientId){
        printPdf('${ctx}/exam/examApply/printPresc', 'examId='+examId +'&visitId='+visitId+'&patientId='+patientId);
    }
</script>
<div class="wrapper no-p" style="background-color: white">
    <div class="table-responsive no-border">
        <%--检查申请table--%>
        <div class="datatable-top">
            <div class="pull-left">
                <form:form hidden="hidden" id="examApplyForm" modelAttribute="examApply"
                           onsubmit="return loadDivForm('rightDiv','examApplyForm','${ctx}/exam/examApply/queryByCondition');"
                           method="post" class="form-inline">
                    <form:hidden path="patientId"/>
                    <form:hidden path="visitId" />

                    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                    <%--检查项目 ：--%>
                    <%--<form:input path="itemName" htmlEscape="false" maxlength="50"--%>
                    <%--class="form-control"/> &nbsp;--%>
                    <%--<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>--%>
                </form:form>
            </div>
        </div>
        <table id="examApplyTable" class="table table-bordered mg-t datatable">
            <thead>
            <tr>
                <th>申请时间</th>
                <th>申请单号</th>
                <th>执行科室</th>
                <th>确认状态</th>
                <th>操作</th>
                <th style="display: none">ordersId</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${page.list}" var="examApply" varStatus="ex">
                <tr id="${examApply.id}">
                    <td><fmt:formatDate value="${examApply.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <td>${examApply.applyOn}</td>
                    <td>${examApply.implementDeptEt.deptName}</td>
                    <td>${fns:getDictLabels(examApply.confirmFlag,'CONFIRM_DICT','')}</td>
                    <td>
                        <c:if test="${examApply.confirmFlag eq 0}">
                            <a href="#" class="applyBt btn btn-danger btn-xs"
                               onclick="confirmExtend('确认要删除该申请吗？',function(){delLoad('rightDiv','${ctx}/exam/examApply/delete?id=${examApply.id}',
                                       '${ctx}/exam/examApply/queryByCondition?visitId=${examApply.visitId}&patientId=${examApply.patientId}&inoroutFlag=1')})">删除</a>
                            <a href="#"
                               class="btn btn-warning btn-xs"
                               onclick="printPresc('${examApply.id}','${examApply.visitId}','${examApply.patientId}')">打印</a>
                        </c:if>
                        <c:if test="${examApply.confirmFlag eq 1 && examApply.chargeFlag eq 1}">
                            <a href="#" class="applyBt btn btn-danger btn-xs"
                               onclick="confirmExtend('确定要申请退费吗？',function(){delLoad('rightDiv','${ctx}/exam/examApply/outpRetCharge?id=${examApply.id}',
                                       '${ctx}/exam/examApply/queryByCondition?visitId=${examApply.visitId}&patientId=${examApply.patientId}&inoroutFlag=1')})">申请退费</a>
                        </c:if>
                        <c:if test="${examApply.chargeFlag eq 5}">
                            ${fns:getDictLabels(examApply.chargeFlag,'NO_CHARGE','')}
                        </c:if>
                        <c:if test="${examApply.chargeFlag eq 2}">
                            ${fns:getDictLabels(examApply.chargeFlag,'NO_CHARGE','')}
                        </c:if>
                        <c:if test="${examApply.chargeFlag eq 1 && examApply.confirmFlag eq 1}">
                            <a href="https:// api.yizhen.cn /amol-back/clinicalIMages/autoLogin?hospitalId=100485&loginName=${loginName}&password=1&accessionNo=${examApply.applyOn}"
                               class="btn btn-warning btn-xs"  target="_Blank">查看结果</a>
                        </c:if>
                    </td>
                    <td style="display: none">${examApply.ordersId}</td>
                </tr>

                <c:if test="${examApply.examItemList.size()>0}">
                    <tr id="${ex.count}" pid="${examApply.id}">
                        <td colspan="5">
                            <table class="table table-bordered mg-t">
                                <tr>
                                    <th>检查项目</th>
                                    <th>价格</th>
                                </tr>
                                <c:forEach items="${examApply.examItemList}" var="examItems" varStatus="ss">
                                    <tr>
                                        <td>${examItems.itemName}</td>
                                        <td>${examItems.costs}</td>
                                    </tr>
                                </c:forEach>
                            </table>
                        </td>
                    </tr>
                </c:if>
            </c:forEach>
            </tbody>
        </table>
        <div class="pagination">${page}</div>
    </div>
</div>

